package com.eascs.web.o2o.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.eascs.app.dao.PageResult;
import com.eascs.common.util.UrlUtil;
import com.eascs.site.page.PaginationInfo;
import com.eascs.site.view.BaseRestResult;
import com.eascs.site.view.ViewContext;
import com.eascs.tag.MenuTag;
import com.eascs.web.o2o.web.common.BaseMasterViewController;
import com.eascs.web.o2o.web.entity.O2oPlatformRegional;
import com.eascs.web.o2o.web.form.BadStatmentForm;
import com.eascs.web.o2o.web.service.BadStatmentService;
import com.eascs.web.o2o.web.service.ProvinceNameData;


@Controller
@RequestMapping("/badStatment")
public class BadStatmentController  extends BaseMasterViewController {

	@Autowired
	BadStatmentService badStatmentService;

	@Autowired
	ProvinceNameData provinceNameData;
	
	@Override
	public void preHandle() {
		super.preHandle();
		ViewContext.put(MenuTag.CURRENT_MENU_CODE, "badStatment");
	}
	
	
	@RequestMapping(value = "/bs_list")
	// 根据省区查询报表
	public String badStatmentSelect(BadStatmentForm vo) {
		
		String o2ourl = "/restBadStatment/bsr_list";

		if(vo != null){
			String endDate = vo.getEndDate() == null ? "" : vo.getEndDate();
			String province = vo.getProvince() == null ? "" : vo.getProvince();
			o2ourl = UrlUtil.appendUrl(o2ourl, "endDate", endDate);
			o2ourl = UrlUtil.appendUrl(o2ourl, "province", province);
			o2ourl = o2ourl + "&pageIndex=";
		}else{
			o2ourl = o2ourl + "?pageIndex=";
		}
		
		List<O2oPlatformRegional> proList = provinceNameData.getProvinceNameData();
		
		ViewContext.put("o2ourl", o2ourl);
		ViewContext.put("vo", vo);
		ViewContext.put("proList", proList);
		return "badStatment/bs_list";
	}
	
	
	
	
}
